package oop12;

import java.util.InputMismatchException;
import java.util.Scanner;

/**
 * @author oldliu
 * @since 1.0
 */
public class Divide4 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        try {
            System.out.println("请输入被除数：");
            int a = in.nextInt();
            System.out.println("请输入除数：");
            int b = in.nextInt();
            int shang = a / b;
            System.out.println("商是：" + shang);
        } catch (InputMismatchException e) {
            System.out.println("出现了输入错误：" + e);
            e.printStackTrace();
        } catch (ArithmeticException e) {
            System.out.println("除数不能是0");
            e.printStackTrace();
        } catch (Exception e) {
            System.out.println("出现了其他错误：" + e);
            e.printStackTrace();
        } finally {
            System.out.println("除法结束了");
        }

    }
}
